﻿var showdialy = function (isWhat) {
    if (isWhat == "en") {
        $.colorbox({
            opacity: 0.30,
            href: "en_pop_up.html",
            width: 640,
            height: 480,
            onLoad: function () {
                $('#cboxClose').hide()
            }
        });
    }
    else {
        $.colorbox({
            opacity: 0.30,
            href: "cn_pop_up.html",
            width: 640,
            height: 480,
            onLoad: function () {
                $('#cboxClose').hide()
            }
        });
    }
}

function login() {
    if (isLogin() == 0) {
        //3002848674
        //3398726942
        var url = "https://api.weibo.com/oauth2/authorize?" + "client_id=3002848674&response_type=token&redirect_uri=http://www.lattissima.com.cn/SinaCallBack.html";
        window.open(url, "newlogin", "height=480,width=640");
    }

}

function isLogin() {
    var flag;
    $.ajax({
        type: "GET",
        url: "/login.aspx",
        dataType: "text",
        async: false,
        data: "op=getSession&random=" + new Date().toLocaleString(),
        beforeSend: function (xmlHttpRequest) {
        },
        success: function (data, textStatus) {
            alert("isemail:" + data);
            flag = data
        },
        complete: function (xmlHttpRequest, textStatus) {

        },
        error: function () {
            flag = 0;
        }
    });
    return flag
}